﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGePlane : OdGePlanarEnt
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGePlane(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGePlane_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGePlane obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGePlane()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGePlane(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public static OdGePlane kXYPlane
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGePlane_kXYPlane_get();
				OdGePlane result = (intPtr == IntPtr.Zero) ? null : new OdGePlane(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		public static OdGePlane kYZPlane
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGePlane_kYZPlane_get();
				OdGePlane result = (intPtr == IntPtr.Zero) ? null : new OdGePlane(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		public static OdGePlane kZXPlane
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGePlane_kZXPlane_get();
				OdGePlane result = (intPtr == IntPtr.Zero) ? null : new OdGePlane(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		public OdGePlane() : this(GlobalsPINVOKE.new_OdGePlane__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePlane(OdGePlane plane) : this(GlobalsPINVOKE.new_OdGePlane__SWIG_1(OdGePlane.getCPtr(plane)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePlane(OdGePoint3d origin, OdGeVector3d normal) : this(GlobalsPINVOKE.new_OdGePlane__SWIG_2(OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(normal)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePlane(OdGePoint3d uPnt, OdGePoint3d origin, OdGePoint3d vPnt) : this(GlobalsPINVOKE.new_OdGePlane__SWIG_3(OdGePoint3d.getCPtr(uPnt), OdGePoint3d.getCPtr(origin), OdGePoint3d.getCPtr(vPnt)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePlane(OdGePoint3d origin, OdGeVector3d uAxis, OdGeVector3d vAxis) : this(GlobalsPINVOKE.new_OdGePlane__SWIG_4(OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(uAxis), OdGeVector3d.getCPtr(vAxis)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGePlane(double a, double b, double c, double d) : this(GlobalsPINVOKE.new_OdGePlane__SWIG_5(a, b, c, d), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool intersectWith(OdGePlane plane, OdGeLine3d intLine, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGePlane_intersectWith__SWIG_0(this.swigCPtr, OdGePlane.getCPtr(plane), OdGeLine3d.getCPtr(intLine), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool intersectWith(OdGePlane plane, OdGeLine3d intLine)
		{
			bool result = GlobalsPINVOKE.OdGePlane_intersectWith__SWIG_1(this.swigCPtr, OdGePlane.getCPtr(plane), OdGeLine3d.getCPtr(intLine));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool intersectWith(OdGeBoundedPlane plane, OdGeLineSeg3d intLine, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.OdGePlane_intersectWith__SWIG_2(this.swigCPtr, OdGeBoundedPlane.getCPtr(plane), OdGeLineSeg3d.getCPtr(intLine), OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool intersectWith(OdGeBoundedPlane plane, OdGeLineSeg3d intLine)
		{
			bool result = GlobalsPINVOKE.OdGePlane_intersectWith__SWIG_3(this.swigCPtr, OdGeBoundedPlane.getCPtr(plane), OdGeLineSeg3d.getCPtr(intLine));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double signedDistanceTo(OdGePoint3d point)
		{
			double result = GlobalsPINVOKE.OdGePlane_signedDistanceTo(this.swigCPtr, OdGePoint3d.getCPtr(point));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePlane set(OdGePoint3d point, OdGeVector3d normal)
		{
			OdGePlane result = new OdGePlane(GlobalsPINVOKE.OdGePlane_set__SWIG_0(this.swigCPtr, OdGePoint3d.getCPtr(point), OdGeVector3d.getCPtr(normal)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePlane set(OdGePoint3d uPnt, OdGePoint3d origin, OdGePoint3d vPnt)
		{
			OdGePlane result = new OdGePlane(GlobalsPINVOKE.OdGePlane_set__SWIG_1(this.swigCPtr, OdGePoint3d.getCPtr(uPnt), OdGePoint3d.getCPtr(origin), OdGePoint3d.getCPtr(vPnt)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePlane set(double a, double b, double c, double d)
		{
			OdGePlane result = new OdGePlane(GlobalsPINVOKE.OdGePlane_set__SWIG_2(this.swigCPtr, a, b, c, d), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePlane set(OdGePoint3d origin, OdGeVector3d uAxis, OdGeVector3d vAxis)
		{
			OdGePlane result = new OdGePlane(GlobalsPINVOKE.OdGePlane_set__SWIG_3(this.swigCPtr, OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(uAxis), OdGeVector3d.getCPtr(vAxis)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePlane Assign(OdGePlane plane)
		{
			OdGePlane result = new OdGePlane(GlobalsPINVOKE.OdGePlane_Assign(this.swigCPtr, OdGePlane.getCPtr(plane)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
